﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Globalization;
using System.Threading;
using System.Configuration;

namespace TenderSampleApp.Code
{
    public class ActionFilterSystem: ActionFilterAttribute, IActionFilter
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            string culture = HttpContext.Current.Request.UserLanguages[0];

            //string culture = (filterContext.HttpContext.Session["culture"] != null)
            //    ? filterContext.HttpContext.Session["culture"].ToString()
            //    : "uk";
            CultureInfo cultureInfo = new CultureInfo(culture);
           
            Thread.CurrentThread.CurrentCulture = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;
         
        }
    }
}